<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
	//get form data
	$account = $_POST["accountnumber"];
	$firstname = $_POST["firstname"];
	$lastname = $_POST["lastname"];
	$address = $_POST["address"];
	$phone = $_POST["phone"];
	$nic = $_POST["nic"];
	//refrence
	$reffirstname = $_POST["reffirstname"];
	$reflastname = $_POST["reflastname"];
	$refaddress = $_POST["refaddress"];
	$refphone = $_POST["refphone"];
	$refnic = $_POST["refnic"];
	$item = $_POST["item"];
	
	//account information
	$originalamount = $_POST["originalamount"];
	$profit = $_POST["profit"];
	$totalamount = $_POST["totalamount"];
	$advance = $_POST["advance"];
	$remaining = $_POST["remaining"];
	$installments = $_POST["installmentpermonth"];
	
	if($account&&$firstname&&$lastname&&$address&&$phone&&$nic&&$reffirstname&&$reflastname&&$refaddress&&$refphone&&$refnic&&$item&&$originalamount&&$profit&&$totalamount&&$advance&&$remaining&&$installments){
	
	//connection
   
	include("connect.php");
		
	//insert into db
	$sql="INSERT INTO accountinfo(accountnum,firstname,lastname,address, phoneno, nic,ref_firstname,ref_lastname,ref_address,ref_phoneno,ref_nic,item,originalamount,profit,totalamount,advance,remaining,installments) VALUES('$account','$firstname','$lastname','$address','$phone','$nic','$reffirstname','$reflastname','$refaddress','$refphone','$refnic','$item','$originalamount','$profit','$totalamount','$advance','$remaining','$installments')";

	if (mysql_query($sql,$con))
  	{
  		echo "Record of Person ".$firstname." added successfully.    <a href='manageCustomer.php'>Click</a>  here to go back and try again.";
		
		//header("location:admin.php");
  	}
	else{
		echo "Sorry! Try again...";
		}
	
	}
	else 
	{
	echo "Please Fill All Fields to Add Customer in Your Data Base!!!    <a href='addCustomer.php'>Click</a>  here to go back and try again.";
	}			
	?>
</body>
</html>
